import conf from './config';
import { sendClickData, sendViewData, sendPageViewData } from './report';
import { LXClickData, LXViewData, LXPVData } from './types';

/**
 * 点击点手动上报
 * @param data 点击点数据 或者 点击点bid
 */
export function fishClick(data: LXClickData | string) {
  sendClickData(typeof data === 'string' ? { valBid: data } : data, conf);
}

/**
 * 曝光点手动上报
 * @param data 曝光点数据 或者 曝光点bid
 */
export function fishView(data: LXViewData | string) {
  sendViewData(typeof data === 'string' ? { valBid: data } : data, conf);
}

/**
 * pv点手动上报
 * @param data  pv点数据 或者 pv点bid
 */
export function fishPV(data: LXPVData | string) {
  sendPageViewData(typeof data === 'string' ? { data: { cid: data } } : { data }, conf);
}

export default {
  fishClick,
  fishView,
  fishPV,
};
